<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        /* 作用：将对象通用的方法挂载在原型上 */
        function Person(name,age){
            this.name = name;
            this.age = age;
        }
        /* sayAge */
        Person.prototype.sayAge = function(){
            console.log(this.age);
        }
        /* 实例化一个对象 */
        var s = new Person("cheng",20);
        console.log(s);
        console.log(Person.prototype);
    </script>
</body>
</html>